package com.baoer.controller;

import com.baoer.R;
import com.baoer.dto.req.*;
import com.baoer.service.UserService;
import lombok.RequiredArgsConstructor;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestParam;
import org.springframework.web.bind.annotation.RestController;

/**
 * @Author: YING
 * @CreateTime: 2025-06-22
 * @Description: 用户控制层
 * @Version: 1.0
 */

@RestController
@RequiredArgsConstructor
public class UserController {
    public final UserService userService;
    //查询分店信息
    @PostMapping("/getUserInfo")
    public R getUserInfo(@RequestBody UserInfoReqDTO userInfoReqDTO){
        return userService.getUserInfo(userInfoReqDTO);
    }
    //修改分店信息
    @PostMapping("/updateUserInfo")
    public R updateUserInfo(@RequestBody UpdateuUserInfoReqDTO userInfoReqDTO){
        return userService.updateUserInfo(userInfoReqDTO);
    }
    //删除分店信息
    @PostMapping("/delUserInfo")
    public R delUserInfo( @RequestParam Integer id){
        return userService.delUserInfo(id);
    }
    //添加分店信息
    @PostMapping("/addUserInfo")
    public R addUserInfo( @RequestBody AddUserInfoReqDTO addUserInfoReqDTO){
        return userService.addUserInfo(addUserInfoReqDTO);
    }
    //分店销售信息
    @PostMapping("/getSaleInfo")
    public R getSaleInfo( @RequestBody GetSaleInfoReqDTO getSaleInfoReqDTO){
        return userService.getSaleInfo(getSaleInfoReqDTO);
    }
    //总店操作员信息
    @PostMapping("/getOperatorInfo")
    public R getOperatorInfo(@RequestBody GetOperatorInfoReqDTO getOperatorInfoReqDTO){
        return userService.getOperatorInfo(getOperatorInfoReqDTO);
    }
    //添加总店操作员
    @PostMapping("/addOperatorInfo")
    public R addOperatorInfo(@RequestBody AddOperatorInfoReqDTO addOperatorInfoReqDTO){
        return userService.addOperatorInfo(addOperatorInfoReqDTO);
    }
    //添加分店信息所属门店下拉框
    @PostMapping("/getstoreInfo")
    public R getstoreInfo(){
        return userService.getstoreInfo();
    }
    //添加总店操作员所属门店下拉框
    @PostMapping("/getheadstoreInfo")
    public R getheadstoreInfo(){
        return userService.getheadstoreInfo();
    }

}
